Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update typespec for cursor_for_record function #114

Merged
merged 2 commits into from
Apr 7, 2021

Conversation

kaylenmistry
Copy link
Contributor

@kaylenmistry kaylenmistry commented Mar 30, 2021

Currently Dialyzer fails for the cursor_for_record/3 function with the following error:

The function call will not succeed.

Paginator.cursor_for_record(_post :: %Post{_ => _}, [{:id, :asc}]) ::
  :ok
def a() do
  :ok
end

will never return since it differs in arguments with
positions 2nd from the success typing arguments:

(any(), [atom()])

This is similar to the second example provided in the function docs:

Paginator.cursor_for_record(%Paginator.Customer{id: 1, name: "Alice"}, [id: :asc, name: :desc])

This PR updates the type spec for the cursor_for_record/3 function, with support for atom, atom keyword lists.

Copy link
Contributor

@sgerrand sgerrand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. 👍

@sgerrand sgerrand merged commit ba48504 into duffelhq:main Apr 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants